<template>
    <div class="page">
        <div class="banner">
            <div class="bg">
                <div class="head">神单 红料 来给球体育</div>
                <div class="title">
                    <p>
                        资深行业专家深耕多年方案推荐
                    </p>
                    <p>
                        百万用户正在使用
                    </p>
                </div>
                <div class="tip">扫码下载手机APP</div>
            </div>
            <!-- <canvas id="qrcode" /> -->
            <div class="qrcode">
                <img src="../status/qecode.png" alt="">
            </div>
        </div>
        <div class="main">
            <div class="main-top">在给球体育 每天都有<span>500+</span>专家方案</div>
            <div class="main-title">简单三步 查看方案</div>
        </div>
        <div class="img">
            <div class="stop-img">
                <div class="stop1">
                    <div class="text">1.下载注册</div>
                    <div class="title">给球体育</div>
                </div>
                <div class="stop2">
                    <div class="text">2.大v板块</div>
                    <div class="title">浏览方案</div>
                </div>
                <div class="stop3">
                    <div class="text">3.解锁文章</div>
                    <div class="title">查看方案文章</div>
                </div>
            </div>
            <div class="img-content">
                <div class="content-top">
                    <span>连红大v</span>云集 资深专栏信息
                </div>
                <div class="content-title">汇集各彩种知名专家 给用户最好的方案</div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import qrcode from 'qrcode'
import {
    onBeforeUnmount,
    onMounted,
} from 'vue'
const updateQrcode = () => {
    const dom =
        document.querySelector('#qrcode')
    const url =
        location.origin + '/#/download'
    const width = window.innerWidth / 10
    const options = {
        width,
        margin: 2,
    }
    if (dom) {
        qrcode.toCanvas(dom, url, options)
    }
}
onMounted(() => {
    updateQrcode()
    window.addEventListener(
        'resize',
        updateQrcode,
    )
})

onBeforeUnmount(() => {
    window.removeEventListener(
        'resize',
        updateQrcode,
    )
})
</script>
<style lang="scss" scoped>
$qrcodeWidth: 10vw;

* {
    box-sizing: border-box;
}

.page {
    padding-top: 10vh;

    .banner {
        position: relative;

        background-image: url('../status/homeImg.png');
        background-size: contain;
        background-repeat: no-repeat;
        height: 50vw;

        .bg {
            display: block;
            padding-top: 8.02vw;
            text-align: center;

            .head {
                font-size: 5.21vw;
                color: #fff;

            }

            .title {
                margin-top: 1.5vw;
                font-size: 2.6vw;
                color: #C4D8FF;
            }

            .tip {
                margin-top: 5.36vw;
                font-size: 1.35vw;
                color: #fff;

            }

        }
    }

    .main {
        text-align: center;

        .main-top {
            margin-top: 4.79vw;
            font-size: 3.65vw;
            color: #2B2B2B;

            span {
                color: #409AFF;
            }
        }

        .main-title {
            margin-top: 3.13vw;
            font-size: 2.6vw;
            color: #818181;
        }
    }

    .img {
        padding: 0 4.3vw;
        margin-top: 3.65vw;


        .stop-img {
            margin-bottom: 1.72vw;
            width: 91.35vw;
            height: 14.76vw;
            display: flex;
            align-items: center;
            justify-content: space-between;

            div {
                margin-left: 0.12vw;
            }

            :first-child {
                margin-left: 0;
            }

            .stop1 {
                background-image: url('../status/stop1.png');
                background-size: cover;
                background-repeat: no-repeat;
                height: 14.76vw;
                width: 30vw;
                padding-left: 10.5vw;
                display: flex;
                flex-direction: column;
                justify-content: center;                

                .text {
                    font-weight: bold;
                    font-size: 2.3vw;
                    color: #4269B2;
                }

                .title {
                    font-weight: bold;
                    font-size: 1.8vw;
                    color: #7390C6;
                }
            }

            .stop2 {
                background-image: url('../status/stop2.png');
                background-size: cover;
                background-repeat: no-repeat;
                height: 14.76vw;
                width: 30vw;
                padding-left: 10.5vw;
                display: flex;
                flex-direction: column;
                justify-content: center; 
                
                .text {
                    font-weight: bold;
                    font-size: 2.3vw;
                    color: #3CA2BD;
                }

                .title {
                    font-weight: bold;
                    font-size: 1.8vw;
                    color: #75C1D5;
                }
            }

            .stop3 {
                background-image: url('../status/stop3.png');
                background-size: cover;
                background-repeat: no-repeat;
                height: 14.76vw;
                width: 29vw;
                padding-left: 10.5vw;
                display: flex;
                flex-direction: column;
                justify-content: center; 
                
                .text {
                    font-weight: bold;
                    font-size: 2.3vw;
                    color: #7462CB;
                }

                .title {
                    font-weight: bold;
                    font-size: 1.8vw;
                    color: #AAA0DB;
                }
            }
        }

        .img-content {
            height: 16.74vw;
            background-image: url('../status/homeList2.png');
            background-size: cover;
            background-repeat: no-repeat;
            padding-left: 4.32vw;
            padding-top: 4.74vw;

            .content-top {
                font-size: 3.13vw;
                color: #2B2B2B;

                span {
                    color: #C60E0E;
                }

            }

            .content-title {
                margin-top: 1.41vw;
                color: #E59191;
                font-size: 2.6vw;
            }
        }
    }
}

.qrcode {
    position: absolute;
    width: $qrcodeWidth;
    height: $qrcodeWidth;
    top: 32.66vw;
    left: calc(50vw - $qrcodeWidth / 2);
    background-color: aqua;

    img {
        height: 100%;
        width: 100%;
    }
}
</style>
